# -*- coding:utf-8 -*-
# https://wangzhangfei.blog.csdn.net/article/details/108952628
# 文件名：自动获取文件名

import os
import sys
import logging

from pylog_utils import pylog

if __name__ == "__main__":
    """test pylog"""
    dir1 = './log'
    def_file_name = pylog.pylog.get_log_base_name()
    # print(def_file_name)

    if len(sys.argv) <= 1:
        print("get log name: error ! use default name:{0}".format(def_file_name))
        pass
    else:
        # write_log(sys.argv[1])
        def_file_name = sys.argv[1]
        pass

    if not os.path.exists(dir1):
        os.mkdir(dir1)

    file_name = '{0}/{1}'.format(dir1, def_file_name)
    obj1 = pylog.pylog(file_name)
    obj1.write_info_log("hell最烦疫情了")
